package com.ruoyi.web.domain.park;


import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.web.pojo.request.park.ParkAddReq;
import com.ruoyi.web.pojo.request.park.ParkPageReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 园区表(park)实体类
 *
 * @author zq
 * @since 2024-01-05 15:09:23
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel(value = "Park对象", description = "园区表")
public class Park extends BaseEntity {

    /**
     * id
     */
    @ApiModelProperty("id")
	private Long id;
    /**
     * 家庭农场名称
     */
    @ApiModelProperty("家庭农场名称")
    private String parkName;
    /**
     * 农场主名称
     */
    @ApiModelProperty("农场主名称")
    private String owner;
    /**
     * 联系方式
     */
    @ApiModelProperty("联系方式")
    private String phone;
    /**
     * 经营类型
     */
    @ApiModelProperty("经营类型")
    private String business;
    /**
     * 经营面积(亩)
     */
    @ApiModelProperty("经营面积(亩)")
    private String scale;

    /**
     * 所在地区
     */
    @ApiModelProperty("所在地区")
    private String location;
    /**
     * 详细地址
     */
    @ApiModelProperty("详细地址")
    private String fullAddress;
    /**
     * 开办年份
     */
    @ApiModelProperty("开办年份")
    private String startDate;
    /**
     * 示范等级
     */
    @ApiModelProperty("示范等级")
    private String demonstrationLevel;

    /**
     * 用户id
     */
    @ApiModelProperty("用户id")
    private Long userId;

    @ApiModelProperty("删除标志（0代表存在 2代表删除）")
    private String delFlag;

    @ApiModelProperty("删除者")
    private String delBy;

    public static Park toPark(ParkAddReq parkAddReq) {
        if (parkAddReq == null) {
            return null;
        }
        Park park = new Park();
        park.setParkName(parkAddReq.getParkName());
        park.setOwner(parkAddReq.getOwner());
        park.setPhone(parkAddReq.getPhone());
        park.setBusiness(parkAddReq.getBusiness());
        park.setScale(parkAddReq.getScale());
        park.setLocation(parkAddReq.getLocation());
        park.setFullAddress(parkAddReq.getFullAddress());
        park.setStartDate(parkAddReq.getStartDate());
        park.setDemonstrationLevel(parkAddReq.getDemonstrationLevel());
        park.setUpdateTime(parkAddReq.getUpdateTime());
        park.setCreateTime(parkAddReq.getCreateTime());

        // Not mapped Park fields:
        // id
        // userId
        return park;
    }

    public static Park toParkPage(ParkPageReq parkAddReq) {
        if (parkAddReq == null) {
            return null;
        }
        Park park = new Park();
        park.setParkName(parkAddReq.getParkName());
        park.setOwner(parkAddReq.getOwner());
        park.setPhone(parkAddReq.getPhone());
        park.setBusiness(parkAddReq.getBusiness());
        park.setScale(parkAddReq.getScale());
        park.setLocation(parkAddReq.getLocation());
        park.setFullAddress(parkAddReq.getFullAddress());
        park.setStartDate(parkAddReq.getStartDate());
        park.setDemonstrationLevel(parkAddReq.getDemonstrationLevel());
        park.setUpdateTime(parkAddReq.getUpdateTime());
        park.setCreateTime(parkAddReq.getCreateTime());

        // Not mapped Park fields:
        // id
        // userId
        return park;
    }
}